home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
bioinformatics.org
/
bioinformatics.org_software.tar
/
www.bioinformatics.org
/
download
/
ecell2
/
ecell220setup.exe
/
{app}
/
standard
/
SRCJ
/
DataField.java
< prev
next >
Wrap
Text File
|
2002-07-03
|
15KB
|
497 lines
/**
* title: DataField class (DataField.java)<p>
* description: Specialized class for definition of the JNI method<p>
* Copyright (C) 1996-2001 Keio University <p>
* Copyright (C) 1998-2001 Japan Science and Technology Corporation (JST)<p>
* GNU General Public Licence <p>
* Division: Mitsui Knowledge Industry Co. Ltd. Bioscience division <p>
* Version : $Id: DataField.java,v 1.7 2002/05/13 00:23:04 ota Exp $ <p>
*/
package ecell;
import java.util.StringTokenizer;
import javax.swing.*;
import java.awt.event.*;
/**
* Specialized class for definition of the JNI method
* @author XD.Zheng
* @version 1.0
* @since JDK1.2.2
*/
public class DataField {
/**
* Instance of controll panel
*/
MainWindow win;
/**
* Constructor
* @param window Instance of controll panel
*/
public DataField(MainWindow window){
this.win = window;
}
/**
* Prepare the method for generating the Substance window from JNI.
* @param code Window Number
* @param str1 Substance EntryName
* @param str2 Substance Name
* @return void
*/
private void creatSubstance(int code,String str1,String str2){
Substance substance = new Substance(code,str1,str2,win);
//win.vSubstance.addElement(substance);
substance.setVisible(true);
//substance.setLocation(150,100);
}
/**
* Prepare the method for generating the Reactor window from JNI.
* @param code Window Number
* @param str1 Reactor EntryName
* @param str2 Reactor Name
* @param str3 Reactor className
* @return void
*/
private void creatReactor(int code,String str1,String str2,String str3){
Reactor reactor = new Reactor(code,str1,str2,str3,win);
//win.vReactor.addElement(reactor);
reactor.setVisible(true);
//reactor.setLocation(150,100);
}
/**
* Prepare method for generating the Tracer window from JNI.
* @param list1 EntryName
* @param list2 Name
* @param list3 ClassName
* @param objCodes SubstanceNumber
* @param objTypes SubstanceType
* @return void
*/
private int creatTracer(String list1,String list2,String list3,int[] objCodes,int[] objTypes ){
StringTokenizer st = new StringTokenizer(list1,"\n");
StringTokenizer st2 = new StringTokenizer(list2,"\n");
StringTokenizer st3 = new StringTokenizer(list3,"\n");
int count = st.countTokens();
String[] entryName=new String[count];
String[] name= new String[count] ;
String[] cname= new String[count];
for(int i=0;i<count;i++){
entryName[i]=st.nextToken();
name[i]=st2.nextToken();
cname[i]=st3.nextToken();
}
Tracer tracer = new Tracer(win,win.tracerNumber);
int no=win.tracerNumber;
win.tracerNumber++;
//win.vTracer.addElement(tracer);
tracer.setCheckBox(entryName,name,cname,objCodes,objTypes );
tracer.setVisible(true);
//tracer.setLocation(150,100);
tracer.dispatchEvent( new ComponentEvent( tracer, ComponentEvent.COMPONENT_RESIZED ) );
return no;
}
/**
* Prepare the method for closing the Substance window from JNI.
* @param code Window Number
* @return void
*/
/**
void closeSubstance(int code){
for(int i=0;i<win.vSubstance.size();i++){
Substance ss =(Substance) win.vSubstance.elementAt(i);
if (ss.subCode==code){
ss.exit_actionPerformed();
i--;
}
}
}
**/
/**
* Prepare the method for closing the Reactor window from JNI.
* @param code Window Number
* @return void
*/
/**
private void closeReactor(int code){
for(int i=0;i<win.vReactor.size();i++){
Reactor rt=(Reactor) win.vReactor.elementAt(i);
if(rt.rctCode==code){
rt.exit_actionPerformed();
i--;
}
}
}
**/
/**
* Prepare the method for closing the Tracer window from JNI.
* @param code Window Number
* @return void
*/
/**
private void closeTracer(int code){
for(int i=0;i<win.vTracer.size();i++){
Tracer tc=(Tracer)win.vTracer.elementAt(i);
if(tc.tracerNumber==code){
win.vTracer.remove(i);
tc.exitTracer();
}
}
}
**/
/**
* Display a message from JNI on the UI window.
* @param message Displayed message
* @return void
*/
protected void showMessage1(String message){
String title="Message Dialog";
JOptionPane.showMessageDialog(null,message,title,JOptionPane.INFORMATION_MESSAGE);
}
/**
* Display a message from JNI on the UI window.
* @param message Displayed message
* @param button1 Button1
* @param button2 Button2
* @return <code>1</code> Push button1
* <code>2</code> Push button2
*/
private int showMessage2(String message, String button1,String button2){
String title="Message Dialog";
Object[] options=new Object[2];
options[0]=button1;
options[1]=button2;
int ret=JOptionPane.showOptionDialog(null,message,title,0,
JOptionPane.ERROR_MESSAGE,null,options,options[0]);
return ret+1;
}
/**
* Display a message from JNI on the UI message window.
* @param message Displayed message
* @return void
*/
protected void showMessage3(String message)
{
win.messageWindow.setMessage( message, false );
}
/**
* Thread is started by JNI.
* @return void
*/
protected void startThread(){
win.startAction();
}
/**
* Thread is stopped by JNI.
* @return void
*/
protected void stopThread(){
win.stopAction();
win.setStopActionFlag( true );
}
/**
* Inform the end of reading UIScript from JNI.
* @return void
*/
private void setScriptFlag(){
win.setScriptFlag();
}
/**
* Natice method :Get tracer data
* @param count The number of times
* @param code Substance Number
* @param data Ouptput Data Arrangement data[0]= time, data[1]=Data
* @return void
*/
public native void getTracerData(int count, int code,double[] data ) throws Exception;
/**
* Native method
* Send the change to JNI when the "+" or "-" button on Substance window is pushed.
* @param number Window Number
* @param a 1 "+" ,-1 "-".
* @return void
*/
public native void setJniChange(int number,int a) throws Exception;
/**
* Native method : Get data from the Substance window.
* @param count The number of steps
* @param code Window Number
* @param data2 Ouptput Data Array
* @return void
*/
public native void getSubstanceData(int count,int code, double[] data2) throws Exception;
/**
* Native method : Get data from the Reactor window.
* @return void
* @param count The number of steps
* @param data Ouptput Data Array
* @return void
*/
public native double getReactorData(int count,int code) throws Exception;
/**
* Native Method : Inform JNI when the button on the Tracer window is pushed.
* @return (Nothing)
* @param t Window Number
* @param flag -1 Close button : 1 Add button : 0 Open
* @return void
*/
public native void setTracerState(int t,int flag) throws Exception;
/**
* Native Method :Inform JNI when the button on the Substance window is pushed.
* @param s Window Number
* @param flag -1 Close button
* @return void
*/
public native void setSubstanceState(int s,int flag) throws Exception;
/**
* Native Method :Inform JNI of the condition of FixCheckBox on the Substance window.
* @param s Window Number
* @param bl State of Fix : true select : false not select
* @return void
*/
public native void setSubstanceFix(int s,boolean bl) throws Exception;
/**
* Native Method : Transfer the value, contained in the textfield on the Substance window, to JNI
* @return (Nothing)
* @param s Window Number
* @param type Classification of TextField : 0 quantity 1 concentration
* @param data Input data
* @return void
*/
public native void setSubstanceText(int s,int type,double data) throws Exception;
/**
* Native Method : Inform JNI when the button on the Reactor window is pushed.
* @param s Window Number
* @param flag -1 Close button
* @return void
*/
public native void setReactorState(int s,int flag) throws Exception;
/**
* Native Method
* Get the name list of Substrate, Product, Catalyst, and Effector on the Reactor window.
* There can be some items, delimited by space characters, in a string.
* @param s Window number
* @return The name list of Substrate, Product, Catalyst, Effector
*/
public native String[] getReactorSpce(int s) throws Exception;
/**
* Native method : Get the Param Name from the Reactor window.
* @param s Window Number
* @return Param Name
*/
public native String[] getReactorParamName(int s) throws Exception;
/**
* Native method : Get the Param Value from the Reactor window.
* @param s Window Number
* @param values Ouptput Data arrangement
* @return void
*/
public native void getReactorParamValue(int s,double[] values) throws Exception;
/**
* Native method : Set Preference
* @param step step
* @param update update
* @return void
*Correspondent relation int cp_preference(Float *s,int *u) (6.1.1)
*/
public native void setPreference(double step, int update) throws Exception;
/**
* Native method : Process Rule file (Load Rule).
* @param filename FileName
* @return void
*/
public native int setRuleFile(String filename) throws Exception;
/**
* Native method : Process Script file (Load Script).
* @param filename FileName
* @return void
*/
public native int setScriptFile(String filename) throws Exception;
/**
* Native method : Process CellState file (Load Cell State)
* @param filename FileName
* @return void
*/
public native void setCellStateFile(String filename) throws Exception;
/**
* Get the progress time of simulation from CORE.
* @return double Progress time in second within simulation
*/
public native double getTime();
/**
* Prepare the method for calling a Java method at the JNI side.
* @return void
*/
public native void setWindows() throws Exception;
/**
* Prepare the method for calling a Java method at the JNI side.
* @return void
*/
public native void closeWindows() throws Exception;
/**
* Get contents of the tree structure of EntrySelector.
* @return Data array
*/
public native String getEntryData() throws Exception;
/**
* Return the item, selected at the EntrySelector window, to JNI.
* @param windowNumber Tracer Number -1 Substance, Reactor >=0
* @param UiType Window type 1 Substance 2 Reactor
* @param windowId Returned data array The last element is 0.
*/
public native void setEntrySelected(int windowNumber,int UiType, int windowId ) throws Exception;
/**
* When a button of MainWindow is pushed, CORE reacts with the corresponding behavior.
* @param type Window button 0 Start 1 Stop 2 Step
* @return void
*/
public native int setMainWindowState(int type);
/**
* Pass Param to CORE when the software starts up.
* @param arg Param
* @return <code>1</code> Open the rule file.
* <code>0</code> Don't open the rule file.
*/
public native int setMainWindowsArg(String arg) ;
/**
* Get the Preference Step value from CORE.
* @return Step
*/
public native double getPreferenceStep();
/**
* Get the Preference Update value from CORE.
* @return Update
*/
public native int getPreferenceUpdate();
/**
* Get the Number of Substance Data from CORE.
* @param objCode Substance code
* @return Number of Substance Data
*/
public native int getTracerDataNumber(int objCode);
/**
* Get the Substance Data from CORE.
* @param objCode Substance code
* @param times Time data
* @param datas Data
* @return void
*/
public native void getAllTracerData(int objCode,double[] times,double[] datas);
/**
* Native method : Process CellState file (Save Cell State).
* @param filename File name
* @return void
*/
public native void saveCellStateFile(String filename) throws Exception;
/**
* Save Tracer window.
* @param Tracer Window Number
* return void
*/
public native void saveTracer(int objNumber) ;
/********************************** for ecell2.2 **********************************/
public native int calc( int steps, double time_to_stop );
public native int updateInterface();
public native int loadCs( String if_name );
public native int saveCs( String if_name );
public native int loadRule( String if_name );
public native void saveScriptFileName( String if_name );
public native void releaseReactor();
public native void rescue();
public native boolean ready();
public native void setDelta( double dt, int opt );
public native double getDelta();
public native void setTime( double tm );
public native int initCore( int arg_c, String str );
public native void osifAddPath( String if_name );
public native int vmDir( String if_path, int priority );
public native int makeInterface( String if_type );
public native int messageInterface( int i_handle, String if_param );
public native int initializeInterface( int i_handle );
public native int setDefaultAccumulator( String if_param );
public static native boolean loadReactorDlls( int count, String dlls );
public static native String getCoreVersion();
public static native void getInitValues( int e_no, double[] data );
}